import {
	defineStore
} from "pinia"
import {
	addhistorvyApi,
	GetHistory,
	Category
} from '@/api/modules/history.js'

// 定义pinia仓库
export const HistoryStore = defineStore('HistoryStore', {
	state: () => ({
		// 历史记录列表
		historyList: [],
	}),
	actions: {
		async getHistory(data) {
			const res = await addhistorvyApi(data)
			console.log(res);
			this.getHistoryList()
		},
		async getHistoryList() {
			this.historyList = []
			const res = await Category(1)
			uni.setStorageSync('HISTORY', res.message)
			console.log(res.message);
		},
	},
	getters: {

	}

})
